<!--{template /module/admin/view/head}-->
<div id="left_layout">
	<div id="main_content" class="container-fluid">
		<!--{template /module/admin/view/head_nav}-->
		<div class="row-fluid">
			<div class="well widget">
				<div class="widget-header">
					<h3 class="title">“{$exam[TITLE]}”{lang exam.index_user.view.header}</h3>
				</div>
				<div class="widget-content">
					<form class="form-search" id="frm_search" name="frmSearch" action="{$ADMIN_SCRIPT}/exam/_user&id={$_var[gp_id]}&nextquery={$_var[gp_nextquery]}" method="post">
					<div class="action-wrapper">
						<div class="pull-left">
							<a href="javascript:void(null);" id="btn_export" class="btn btn-small">{lang exam.index_user.view.button.export}</a>
							<a href="javascript:void(null);" class="btn btn-small" id="btn_clear">{lang exam.index_user.view.button.clear}</a>
							<a href="{$ADMIN_SCRIPT}/exam{$search[prevquery]}" class="btn btn-small">{lang exam.index_user.view.button.back}</a>
						</div>
						<div class="pull-right" {$dispatches[operations][search]}>
							<div class="input-append">
								<input type="text" name="txtKeyword" value="{$_var[gp_txtKeyword]}" class="input-small search-query" />
								<button type="submit" class="btn">{lang admin.search.submit}</button>
							</div>
							<button type="button" state="0" class="btn" id="btn_extend_search">{lang admin.search.submit.extend}<i class="micon-arrow-down"></i></button>
						</div>
					</div>
					</form>
					
					<div id="div_extend_search" style="display:none;">
						<hr/>
						<form id="frm_extend_search" name="frmExtendSearch" action="{$ADMIN_SCRIPT}/exam/_user&id={$_var[gp_id]}&nextquery={$_var[gp_nextquery]}" method="post">
						<input type="hidden" name="hdnSearchShow" id="hdnSearchShow" value="1" />
						<table>
						<tr>
							<td width="46">{lang admin.search.keyword}</td>
							<td>
								<label class="checkbox inline">
									<input type="text" name="txtKeyword" value="{$_var[gp_txtKeyword]}" class="input-medium" />
								</label>
								<label class="checkbox inline">
								<select name="sltType">
						            <option value="0" {if $_var['gp_sltType'] == 0}selected="selected"{/if}>{lang exam.index_user.view.search.type.select.0}</option>
						            <option value="1" {if $_var['gp_sltType'] == 1}selected="selected"{/if}>{lang exam.index_user.view.search.type.select.1}</option>
						            <option value="2" {if $_var['gp_sltType'] == 2}selected="selected"{/if}>{lang exam.index_user.view.search.type.select.2}</option>
						            <option value="3" {if $_var['gp_sltType'] == 3}selected="selected"{/if}>{lang exam.index_user.view.search.type.select.3}</option>
					            </select>
					            </label>
					            
								<!--{if $exam['ISAWARD']}-->
								<label class="checkbox inline">
								<select name="sltIsAward">
						            <option value="0" {if $_var['gp_sltIsAward'] == 0}selected="selected"{/if}>{lang exam.index_user.view.search.isaward.select.0}</option>
						            <option value="1" {if $_var['gp_sltIsAward'] == 1}selected="selected"{/if}>{lang exam.index_user.view.search.isaward.select.1}</option>
						            <option value="2" {if $_var['gp_sltIsAward'] == 2}selected="selected"{/if}>{lang exam.index_user.view.search.isaward.select.2}</option>
					            </select>
					            </label>
								<!--{/if}-->
							</td>
						</tr>
						<tr>
							<td>{lang admin.search.time}</td>
							<td>
								<input type="text" name="txtBeginDate" maxlength="16" class="input-medium input-date" value="{$_var[gp_txtBeginDate]}" />
					            {lang admin.search.to}
					            <input type="text" name="txtEndDate" maxlength="16" class="input-medium input-date" value="{$_var[gp_txtEndDate]}" />
							</td>
						</tr>
						<tr>
							<td></td>
							<td>
								<button type="submit" class="btn btn-primary">{lang admin.search.submit.extend.submit}</button>
							</td>
						</tr>
						</table>
						</form>
					</div>
					
					<hr>
					<form id="frm_grid" name="frmGrid" action="{$ADMIN_SCRIPT}/exam/_user&id={$_var[gp_id]}&page={$_var[page]}&psize={$_var[psize]}{$search[querystring]}" method="post">
					<table class="table table-hover">
						<thead>
							 <tr>
								<th width="30">{lang exam.index_user.view.th.no}</th>
					            <th width="120">{lang exam.index_user.view.th.edittime}</th>
					            <th width="180">{lang exam.index_user.view.th.username}</th>
					            <th width="120">{lang exam.index_user.view.th.mobile}</th>
					            <th>{lang exam.index_user.view.th.result}</th>
					            <!--{if $exam['ISAWARD']}-->
						        <th width="200">{lang exam.index_user.view.th.award}</th>
						        <!--{/if}-->
							</tr>
						</thead>
						<tbody>
							<!--{loop $exam_users $_loop $exam_user}-->
							<tr class="item-row">
								<td>
									{echo $start + $_loop + 1;}、
								</td>
								<td class="f12">{$exam_user[EDITTIME]}</td>
								<td class="f12">{echo $exam_user['REALNAME'] ? $exam_user['REALNAME'] : $exam_user['USERNAME'];} <span class="muted f10">[ID:{$exam_user[USERID]}]</span></td>
								<td>{$exam_user[MOBILE]}</td>
								<td class="f12">
									{lang exam.index_user.view.th.result.all}{$exam_user[RECORD_COUNT]}{lang exam.index_user.view.th.result.unit}；
									{lang exam.index_user.view.th.result.right}{$exam_user[RECORD_RIGHT]}{lang exam.index_user.view.th.result.unit}；
									{lang exam.index_user.view.th.result.error}{echo $exam_user['RECORD_COUNT'] - $exam_user['RECORD_RIGHT'];}{lang exam.index_user.view.th.result.unit}；
									<!--{if $exam_user['OVER'] == 0}-->{lang exam.index_user.view.th.result.empty}！<!--{/if}-->
								</td>
								<!--{if $exam['ISAWARD']}-->
								<td>
									{$exam_user[AWARD]} 
									<!--{if $exam_user['EXAM_AWARDID']}-->
										<a href="javascript:void(null);" class="delete" data="{$exam_user[EXAM_USERID]}">{lang exam.index_user.view.td.delete}</a>
									<!--{/if}-->
								</td>
								<!--{/if}-->
							</tr>
						<!--{/loop}-->
						</tbody>
					</table>
					</form>
					
					<hr/>
					{$pager}
				</div>
			</div>
		</div>
	</div>
</div>

<script>
function search_toggle(){
	var state = $('#btn_extend_search').attr('state');
	if(state == '0'){
		$('#btn_extend_search').html('{lang admin.search.submit.extend.hide}<i class="micon-arrow-up"></i>').attr('state', '1');
	}else{
		$('#btn_extend_search').html('{lang admin.search.submit.extend}<i class="micon-arrow-down"></i>').attr('state', '0');
	}
	
	$('.pull-right .input-append').toggle();
	$('#div_extend_search').toggle();
}

$(function(){
	$('.fancy').uniform();
	$('.input-date').datepicker({format:'yyyy-mm-dd'});
	
	$('#btn_export').click(function(){
		window.open('{$ADMIN_SCRIPT}/exam/_user&do=excel&id={$_var[gp_id]}{$search[querystring]}');
	});
	
	$('#btn_extend_search').click(function(){
		search_toggle();
	});
	
	$('#frm_grid .delete').click(function(){
		var self = this;
		$.dialog({message:'{lang exam.index_user.view.operation.delete}', submit:'{lang exam.index_user.view.operation.delete.submit}', callback:function(){
			$('#modal_dialog .btn-primary').click(function(){
				$.getJSON('{$ADMIN_SCRIPT}/exam/_user&do=delete&id={$_var[gp_id]}&exam_userid=' + $(self).attr('data'), function(data){
					if(data.success == true){
						$(self).parent().html('');
						$('#modal_dialog').modal('hide').remove();
					}else $.dialog({message:data.message});
				});
			});
		}});
	});
	
	$('#btn_clear').click(function(){
		$.dialog({message:'{lang exam.index_user.view.operation.clear}', submit:'{lang exam.index_user.view.operation.clear.submit}', callback:function(){
			$('#modal_dialog .btn-primary').click(function(){
				location.href= '{$ADMIN_SCRIPT}/exam/_user&do=clear&id={$_var[gp_id]}&nextquery={$_var[gp_nextquery]}';
			});
		}});
	});
	
	{if $_var[gp_hdnSearchShow]}
	search_toggle();
	{/if}
});
</script>
<!--{template /module/admin/view/foot}-->